/*     */ package com.qmsk.business.member.memberIntegralConsumeRecord.controller;
/*     */ 
/*     */ import com.qmsk.business.member.memberIntegralConsumeRecord.dao.MemberIntegralConsumeRecordDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.jdbc.connection.DbConnection;
/*     */ import com.utils.web.RequestUtils;
/*     */ import com.utils.web.ResponseUtils;
/*     */ import java.sql.SQLException;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ import org.apache.log4j.Logger;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Controller;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ import org.springframework.web.bind.annotation.PathVariable;
/*     */ import org.springframework.web.bind.annotation.RequestMapping;
/*     */ 
/*     */ @Controller
/*     */ @RequestMapping({"/intConsumeRec"})
/*     */ public class MemberIntegralConsumeRecordController
/*     */ {
/*  32 */   private static final Logger logger = Logger.getLogger(MemberIntegralConsumeRecordController.class);
/*     */ 
/*     */   @Autowired
/*     */   private MemberIntegralConsumeRecordDAO dao;
/*     */ 
/*     */   @RequestMapping(value={"find/all/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*     */   public void getListAll(HttpServletRequest request, HttpServletResponse response, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*     */   {
/*  51 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*     */     try {
/*  53 */       GsonEbRst gsonEbRst = this.dao.getGsonOfAll(nPageIdx, nPageSize);
/*  54 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*     */     } catch (SQLException e) {
/*  56 */       logger.error(e);
/*  57 */       ResponseUtils.setErrorMsgResponse(
/*  58 */         RequestUtils.getFindDataErrorMessage(request), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"insert"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void insert(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/*  74 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/*  76 */       int nResult = this.dao.insertJsonOneRow(sGsonInData);
/*  77 */       DbConnection.commit();
/*  78 */       ResponseUtils.setSqlResultResponse(nResult, 
/*  79 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/*  80 */         response);
/*     */     } catch (Exception e) {
/*  82 */       DbConnection.rollback();
/*  83 */       logger.error(e);
/*  84 */       ResponseUtils.setErrorMsgResponse(
/*  85 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/*  86 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"del"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void delete(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 102 */     String id = RequestUtils.getStringOfId(request);
/*     */     try {
/* 104 */       String[] strParams = id.split(",");
/* 105 */       int nResult = this.dao.deleteParams(strParams);
/* 106 */       DbConnection.commit();
/* 107 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 108 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 109 */         response);
/*     */     } catch (Exception e) {
/* 111 */       DbConnection.rollback();
/* 112 */       logger.error(e);
/* 113 */       ResponseUtils.setErrorMsgResponse(
/* 114 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 115 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ 
/*     */   @Transactional
/*     */   @RequestMapping(value={"edit"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*     */   public void update(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 131 */     String id = request.getParameter("id");
/* 132 */     String sGsonInData = request.getParameter("data");
/*     */     try {
/* 134 */       GsonHeadOneRow g = GsonHeadOneRow.jsonStrToObject(sGsonInData);
/* 135 */       if (g == null) {
/* 136 */         ResponseUtils.setErrorMsgResponse(
/* 137 */           RequestUtils.getReadJsonDataErrorMessage(request), 
/* 138 */           response);
/*     */       } else {
/* 140 */         int nResult = this.dao.updateJsonOneRow(g, id);
/* 141 */         ResponseUtils.setSqlResultResponse(nResult, 
/* 142 */           RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request), 
/* 143 */           response);
/*     */       }
/* 145 */       DbConnection.commit();
/*     */     } catch (Exception e) {
/* 147 */       DbConnection.rollback();
/* 148 */       logger.error(e);
/* 149 */       ResponseUtils.setErrorMsgResponse(
/* 150 */         RequestUtils.getSqlUpdateErrorMessage(sGsonInData, request) + ":" + 
/* 151 */         e.getMessage(), response);
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberIntegralConsumeRecord.controller.MemberIntegralConsumeRecordController
 * JD-Core Version:    0.5.3
 */